import { pa } from 'element-plus/es/locales.mjs'
import request from '../utils/request'

export function getVideoList() {
    return request({
        url: '/user/video/list',
        method: 'get',
    })
}

export function getVideoDetail(vid) {
    return request({
        url: '/user/video/get-one',
        method: 'get',
        params: {
            vid : vid
        }
    })
}

export function getVisitorVideo() {
    return request({
        url: '/user/video/visitor',
        method: 'get',
    })
}

export function getMoreVideo(vids) {
    return request({
        url: '/user/video/visitor/cumulative',
        method: 'get',
        params: {
            vids : vids
        }
    })
}

export function getRecommendVideo() {
    return request({
        url: '/user/video/recommend',
        method: 'get',
    })
}

export function uploadVideoCover(formData) {
    return request({
        url: '/user/video/upload/cover',
        method: 'post',
        data: formData,
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    })
}

export function deleteVideoCover(path) {
    return request({
        url: '/user/video/delete/cover',
        method: 'delete',
        params: {
            path : path
        }
    })
}

export function uploadVideo(path) {
    return request({
        url: '/user/video/delete/cover',
        method: 'delete',
        params: {
            path : path
        }
    })
}

export function askCurrentChunk(hash) {
    return request({
        url: '/user/video/ask/chunk',
        method: 'get',
        params: {
            hash : hash
        }
    })
}

export function uploadChunk(formData) {
    return request({
        url: '/user/video/upload/chunk',
        method: 'post',
        data: formData,
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    })
}

export function cancelUpload(hash) {
    return request({
        url: '/user/video/upload/cancel',
        method: 'get',
        params: {
            hash : hash
        }
    })
}

export function submitVideo(data) {
    return request({
        url: '/user/video/add/video',
        method: 'post',
        data: data,
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    })
}

// 新增播放
export function addNewPlay(vid) {
    return request({
        url: '/user/video/play',
        method: 'post',
        params: {
            vid : vid
        }
    })
}

// 点赞或者点踩
export function likeOrNot(data) {
    return request({
        url: '/user/video/love-or-not',
        method: 'post',
        data: data,
    })
}

// 获取用户点赞的视频
export function getUserLoveVideos(uid, offset, quantity) {
    return request({
        url: '/user/video/user-love',
        method: 'get',
        params: {
            uid : uid,
            offset : offset,
            quantity : quantity
        }
    })
}

// 获取用户投稿的视频
export function getUserWorkVideos(uid, rule, page, quantity) {
    return request({
        url: '/user/video/works',
        method: 'get',
        params: {
            uid : uid,
            rule : rule,
            page : page,
            quantity : quantity
        }
    })
}










